# $Id: PKGBUILD 155305 2012-04-01 14:23:52Z heftig $
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Jason Chu <jchu@xentac.net>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - fix for unimplemented _FPU_EXTENDED
#  - patch to use neon only on 32bit ARM

pkgname=openal
pkgver=1.16.0
pkgrel=1
pkgdesc="A cross-platform 3D audio library"
arch=(i686 x86_64)
url="http://www.openal.org/"
license=(LGPL)
depends=(glibc)
makedepends=(alsa-lib pkgconfig cmake libpulse qt4 fluidsynth portaudio)
optdepends=('qt4: alsoft-config GUI Configurator'
            'fluidsynth: MIDI rendering')
options=('!libtool')
source=(http://kcat.strangesoft.net/openal-releases/openal-soft-$pkgver.tar.bz2
        no-fpuextended.patch
        openal-soft-arm_neon-only-for-32bit.patch)
md5sums=('14db4b0d12f07252070b4fe5eb5911f6'
         'de9569536f9f1c2b7b0e90d381c631de'
         '5ca12576453226897c4d8821039a7f3e')

prepare() {
  cd "${srcdir}/$pkgname-soft-$pkgver"
  patch -p1 -i "${srcdir}"/no-fpuextended.patch
  patch -p1 -i "${srcdir}"/openal-soft-arm_neon-only-for-32bit.patch
}

build() {
  cd "${srcdir}/$pkgname-soft-$pkgver/build"
  cmake -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE=Release ..
  make
}

package() {
  cd $pkgname-soft-$pkgver
  make -C build DESTDIR="$pkgdir/" install
  install -m644 -t "$pkgdir/usr/share/openal" env-vars.txt hrtf.txt
}
